import LinkNode from "./LinkNode";

export default class LinkList<T>{


    private first: LinkNode<T>;
    private end: LinkNode<T>;


    private count:number = 0;

    push(obj: T) {
        let node = new LinkNode<T>();
        this.count ++;
        node.setObj(obj)
        node.setPre(this.end)
        if (!this.first) {
            this.first = node;
        }
        if (this.end) {
            this.end.setNext(node)
        }
        this.end = node;
    }

    size(){
        return this.count;
    }


    getFirt() {
        return  this.first
    }

    getEnd() {
        return  this.end
    }

}